#include<iostream>
using namespace std;
int main(){
    int n;
    while (cin>>n&&n!=0&&n<100)
    {
        int a[100],min=999999,t;
        for(int i=0;i<n;i++){
            cin>>a[i];
            if(min>a[i]){
                min=a[i];
                t=i;
            }
        }
        int temp=a[0];
        a[0]=a[t];
        a[t]=temp;
        for (int i = 0; i < n; i++)
        {
            cout<<a[i];
            if(i!=n-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
    
}